 /******************************************************************************
  * @file    PT32X005_exti.h
  * @author  应用开发团队
  * @version V1.1.0
  * @date    2020/2/14
  * @brief    This file contains all the functions prototypes for the EXTI firmware library.
  *
  ******************************************************************************
  * @attention
  *
  *
  *****************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PT32X005_EXTI_H
#define PT32X005_EXTI_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "PT32X005.h"


/** @addtogroup EXTI
  * @{
  */

/* Exported types ------------------------------------------------------------*/
#define IS_EXTI_ALL_PERIPH(PERIPH)	(((PERIPH) == EXTIA) || \
									((PERIPH) == EXTIB) || \
									((PERIPH) == EXTIC) || \
									((PERIPH) == EXTID))

typedef enum
{
	EXTI_Trigger_Rising,
	EXTI_Trigger_Falling,
	EXTI_Trigger_Rising_Falling,
	EXTI_Trigger_High_Level,
	EXTI_Trigger_Low_Level
} EXTIITrigger_TypeDef;
#define IS_EXTI_Trigger_SEL(SEL)	(((SEL) == EXTI_Trigger_Rising) || \
								((SEL) == EXTI_Trigger_Falling) || \
								((SEL) == EXTI_Trigger_Rising_Falling) || \
								((SEL) == EXTI_Trigger_High_Level) || \
								((SEL) == EXTI_Trigger_Low_Level))


/**  @brief IS_EXTI_PIN_SEL&GET  definition **/
#define IS_EXTI_PIN_SEL(SEL) ((((SEL) & (u32)0xffff0000) == 0) && ((SEL) != (u32)0x0000))
#define IS_EXTI_PIN_GET(SEL)	(((SEL) == EXTI_Pin_0) || \
								((SEL) == EXTI_Pin_1) || \
								((SEL) == EXTI_Pin_2) || \
								((SEL) == EXTI_Pin_3) || \
								((SEL) == EXTI_Pin_4) || \
								((SEL) == EXTI_Pin_5) || \
								((SEL) == EXTI_Pin_6) || \
								((SEL) == EXTI_Pin_7) || \
								((SEL) == EXTI_Pin_8) || \
								((SEL) == EXTI_Pin_9) || \
								((SEL) == EXTI_Pin_10) || \
								((SEL) == EXTI_Pin_11) || \
		    					((SEL) == EXTI_Pin_12) || \
								((SEL) == EXTI_Pin_13) || \
								((SEL) == EXTI_Pin_14) || \
								((SEL) == EXTI_Pin_15) || \
								((SEL) == EXTI_Pin_All))

/**  @brief IS_EXTI_IT_SEL&GET **/
#define IS_EXTI_IT_SEL(SEL) ((((SEL) & (u32)0xffff0000) == 0) && ((SEL) != (u32)0x0000))
#define IS_EXTI_IT_GET(GET)		(((GET) == EXTI_IT_0) || \
								((GET) == EXTI_IT_1) || \
								((GET) == EXTI_IT_2) || \
								((GET) == EXTI_IT_3) || \
								((GET) == EXTI_IT_4) || \
								((GET) == EXTI_IT_5) || \
								((GET) == EXTI_IT_6) || \
								((GET) == EXTI_IT_7) || \
								((GET) == EXTI_IT_8) || \
								((GET) == EXTI_IT_9) || \
								((GET) == EXTI_IT_10) || \
								((GET) == EXTI_IT_11) || \
		    					((GET) == EXTI_IT_12) || \
								((GET) == EXTI_IT_13) || \
								((GET) == EXTI_IT_14) || \
								((GET) == EXTI_IT_15) || \
								((GET) == EXTI_IT_All))


/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void EXTI_ITConfig(EXTI_TypeDef* EXTIx, u32 EXTI_IT, FunctionalState NewState);
void EXTI_TriTypeConfig(EXTI_TypeDef* EXTIx, u32 EXTI_Pin, u32 Trigger_Type);
void EXTI_ClearFlag(EXTI_TypeDef* EXTIx, u32 EXTI_IT_FLAG);
ITStatus EXTI_GetITStatus(EXTI_TypeDef* EXTIx, u32 EXTI_IT);
/**
  * @}
  */


#ifdef __cplusplus
}
#endif

#endif


